#include "GUICheckbox.h"

GUICheckbox::GUICheckbox()
{
    isChecked = false;
}

void GUICheckbox::draw()
{
    DrawHelper::Instance().drawRect2D(0, 0, width, height, borderColor[state], true);
    DrawHelper::Instance().drawRect2D(borderSize, borderSize, width-borderSize, height-borderSize, bgColor[state], true);
    //DrawHelper::Instance().drawRect2D(0, 0, width, height, borderColor[state], false);
    if (isChecked)
    {
        DrawHelper::Instance().drawRect2D(padding, padding, width-padding, height-padding, borderColor[state], true);
    }
}

void GUICheckbox::setChecked(bool newState)
{
    isChecked = newState;
}

bool GUICheckbox::getChecked()
{
    return isChecked;
}

void GUICheckbox::onReleased()
{
    isChecked = !isChecked;
}

void GUICheckbox::onReleased(Uint8 mouseState)
{
    onReleased();
}
